<%--
  Created by IntelliJ IDEA.
  User: Li Chuanwei
  Date: 2023-07-14
  Time: 14:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <title>订单商品详情</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css" media="all">
    <script src="${pageContext.request.contextPath}/static/layui/layui.js" charset="utf-8"></script>
    <style>
        .layui-table-cell {
            text-align: center;
            white-space: normal;
        }
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <table class="layui-hide" id="orderItemTableId" lay-filter="orderItemTableFilter"></table>
    </div>
</div>
<script>
    layui.use(['form', 'table', 'element','layer'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            util = layui.util;
        var rate = layui.rate;
        var laydate = layui.laydate;
        var dropdown = layui.dropdown;

        /**
         * 表格渲染
         */
        table.render({
            elem: '#orderItemTableId',
            autoSort: true,
            request: {
                pageName: 'pageNum', // 页码的参数名称，默认：page
                limitName: 'pageSize' // 每页数据条数的参数名，默认：limit
            },
            url: '${pageContext.request.contextPath}/manager/order_item/list?orderId=' + ${orderId},
            toolbar: '#toolbar',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            totalRow: true, // 开启合计行
            cols: [[
                {title: '序号', type: "numbers", align: "center",totalRow: '合计'},
                {field: 'id',  title: '编号', sort: true,hide:true},
                {field: 'goodsId', title: '商品编号',totalRow: '--'},
                {field: 'goodsName', width: 100, title: '商品名字',totalRow: '--'},
                {field: 'amount',  title: '商品数量', sort: true,totalRow: true},
                {field: 'price',  title: '商品单价', sort: true,totalRow: '--'},
                {field: 'money', title: '商品总金额', sort: true,totalRow: true}
            ]],
            limits: [8, 15, 20, 25, 50, 100],
            limit: 8,
            page: true,
            loading: true,
            skin: 'grid',
        });

        /**
         * 提示栏操作
         */
        table.on('toolbar(orderTableFilter)', function (obj) {
            switch (obj.event) {
                case 'LAYTABLE_TIPS':
                    layer.alert('输入相关信息以查询订单商品详细信息');
                    break;
            }
            ;
        });
    });
</script>
</body>
</html>

